<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<div class="container-fluid" (window:resize)="onResize($event)">
  <div class="row">
    <h5 class="over-title margin-bottom-15">Create Measure</h5>
  </div>
  <div class="row">
    <form name="Form" id="form" #prForm="ngForm" novalidate>
      <div id="wizard" class="swMain">
        <ul>
          <li>
            <a class="selected">
              <div class="stepNumber">
                1
              </div>
              <span class="stepDesc text-small"> Configuration </span>
            </a>
          </li>
        </ul>
      </div>
      <div id="step-1" class="formStep">
        <label class="stepDesc">Please setup the measure required information</label>
        <div class="container-fluid">
          <div class="col-md-12 col-lg-12 col-sm-12">
            <fieldset>
              <legend>
                Required Information
              </legend>
              <div class="y-scrollable">
                <div class="col-md-12 col-lg-12 col-sm-12" style="margin-top:30px;">
                  <div class="form-group"
                       [ngClass]="{'has-error': !valid, 'has-success': valid}">
                    <div class="row">
                      <label class="col-md-2 col-lg-2 col-sm-2 control-label">
                        Raw measure<span class="symbol required"></span>:
                      </label>
                      <div class="col-md-10 col-lg-10 col-sm-10">
                        <div class="btn-group btn-group-sm navbar-right" role="group" aria-label="Format">
                          <button type="button" class="btn btn-flat btn-primary" [ngClass]="{'active': format == Format.json}" (click)="changeFormat(Format.json)">JSON</button>
                          <button type="button" class="btn btn-flat btn-primary" [ngClass]="{'active': format == Format.yaml}" (click)="changeFormat(Format.yaml)">YAML</button>
                        </div>
                      </div>
                    </div>
                    <div class="row">
                      <textarea class="code-viewport fixed-textarea" required [(ngModel)]="data" #content="ngModel" name="content" (ngModelChange)="onInputChange()"></textarea>
                      <span class="error text-small block " *ngIf="!valid">Measure is not valid</span>
                    </div>
                  </div>
                </div>
                <div style="color:#b2c831">
                  <p>
                    <i class="fa fa-info-circle"></i> After submitted, please go to "<a class="bark-link"
                                                                                        routerLink="/measures">Measures</a>"
                    to check the measure status
                  </p>
                </div>
              </div>
            </fieldset>
          </div>
          <div class="form-group btn-container">
            <toaster-container></toaster-container>
            <button type="submit" (click)="submit(prForm)" class="btn btn-primary btn-o next-step btn-wide pull-right">
              Submit
            </button>
          </div>
        </div>
      </div>
      <div class="modal fade" id="confirm" role="dialog" #modal tabindex="-1" [ngClass]="{'in': visibleAnimate}"
           [ngStyle]="{'display': visible ? 'block' : 'none', 'opacity': visibleAnimate ? 1 : 0}"
           (click)="onContainerClicked($event)">
        <div class="modal-dialog modal-xg modal-lg">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" (click)="hide()">&times;</button>
              <h4 class="modal-title">Save the measure?</h4>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" (click)="hide()">Cancel</button>
              <button type="button" id="save" class="btn btn-primary" (click)="save()">Save</button>
            </div>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>
